package com.springcloud.eureka_consumer;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard;
import org.springframework.cloud.openfeign.EnableFeignClients;

/**
 * @author hw
 *
 * <p>
 * <ul>
 * <li>Feign 采用的是基于接口的注解</li>
 * <li>Feign 整合了Hystrix，具有熔断降级的能力</li>
 * <li>Feign 整合了Ribbon，具有负载均衡的能力</li>
 * </ul>
 * </p>
 */
//1.使用Feign进行远程调用
@SpringBootApplication
//@EnableDiscoveryClient是服务发现注册的通用框架，包含在EnableEurekaClient中
@EnableEurekaClient
@EnableFeignClients
@EnableHystrixDashboard
public class EurekaConsumerApplication {

	public static void main(String[] args) {
		SpringApplication.run(EurekaConsumerApplication.class, args);
	}
	
}

/*
 
 //2.使用restTemplate 进行远程调用
@SpringBootApplication
@EnableEurekaClient
public class SpringCloudConsumerApplication {
	
	public static void main(String[] args) {
		SpringApplication.run(SpringCloudConsumerApplication.class, args);
	}
	
	@Bean
	@LoadBalanced
	
	@LoadBalanced是Ribbon客户端负载，默认是轮询方式
	当有多个服务提供者时，默认会以轮询的方式去调用他们
	 
	public RestTemplate restTemplate() {
		return new RestTemplate();
	}
}*/